<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>函数类型</title>
    <script>
        function fn(i, j) {
            let a = fa();
            console.log(a);
            let b = fb();
            console.log(b);
            console.log(i + j);

            // 当调用该方法时传递的实参并不是通过当前函数的形参来接收的
            // 而是通过js的内置对象arguments接收的
            console.log(arguments);
            i = arguments[0];
            j = arguments[1];
            return i + j;
        }

        function fa() {

        }

        function fb() {
            return "b";
        }

        function f1() {
            let f = fn;
            alert(f);
            console.log(f);
        }

        function f2() {
            let fn = function () {
                console.log("匿名函数");
                return "admin";
            };
            alert(fn);
        }

        function f3(){
            // Lambda表达式定义
            let fn = () =>{
                console.log("Lambda表达式")
                return "admin";
            };
            console.log(typeof  fn);
            fn();

            let fn2 = (a,b) => {
                console.log("Lambda表达式,a:"+a+",b:"+b);
                return a;
            };
            fn2("admin","jack");

            let fn3 = a => a;
            fn3 = function(a){
                return a;
            }
            let s = fn3("admin");
            console.log(s);

            let fn4 = () => 3.14;
            fn4 = function(){
                return 3.14;
            }
            s = fn4();
            console.log(s);

        }
    </script>
</head>
<body>
<button onclick="fn(1,2,3,4)">函数特点</button>
<br>
<button onclick="f1()">定义方式一</button>
<br>
<button onclick="f2()">定义方式二</button>
<br>
<button onclick="f3()">定义方式三</button>
</body>
</html>